home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1514 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: noc.tor.hookup.net!the-fix.sos.on.ca
  2. From: <verneb@the-fix.sos.on.ca>
  3. Date: Sun,14 Jan 96 14:45:50 -0500
  4. Newsgroups: comp.lang.c
  5. Subject: Re: What wrong with this code ??????
  6. Message-ID: <tcpnntpd.16.1.14.14.45.50.2781597121.340151@the-fix.sos.on.ca>
  7. References: <4dagqd$g7q@nntp.pinc.com>
  8. Organization: the FIX - Kitchener, Ontario CANADA
  9. NNTP-Posting-Host: the-fix.sos.on.ca
  10. X-MajorTCP-Version: MajorTCP/IP [1.80-0]
  11.  
  12. To: INT:MCOLYNUCK@PIM.BC.CA
  13.  
  14. Int:mcolynuck@pim.bc.ca,
  15.  
  16. I >jarnot@iddis.com (Kevin J. Jarnot) wrote:
  17. I >
  18. I >>>>>>> "PAOPENG" == PAOPENG THEERADECH <tp86@wumpus.cc.uow.edu.au> writes:
  19. I >
  20. I >>    PAOPENG> #include <stdio.h>
  21. I >.NG> /* copy input to output */
  22. I >.NG> main()
  23. I >.NG> {
  24. I >.NG>     int c;
  25. I >.NG>     
  26. I >.NG>     printf("\nPlease Enter the character: ");
  27. I >.NG>     c =getchar();
  28. I >.NG>     while (c != EOF)
  29. I >.NG>     {
  30. I >.NG>         putchar(); /* remove 'c' */
  31. I >.NG>         /*c = getchar; this is not needed */
  32. I >>                                 
  33. I >.NG>     /*} not needed */
  34.                return 0;/* need this to complete program */
  35. I >.NG> }
  36. I >
  37. I >.NG> Do anyone here know what wrong with this code?
  38. I >
  39. I >
  40. I >
  41. I >
  42. I >>I'm not sure if it was your problem, but you forgot the parens
  43. I >>afer getchar.
  44. I >
  45. I >
  46. I >>You should have an interesting value stored in c!  BTW, this is
  47. I >>valid C code, although you'll get a warning about mixing pointers
  48. I >>and integers.
  49. I >
  50. I >
  51. I >
  52. I >>Kevin
  53. I >
  54. I >
  55. I >
  56. I >Might be compiler dependant but shouldn't a the 'char' be an 'unsigned
  57. I >iint' ?
  58. I >
  59. I >Michael
  60. I >
  61. I >
  62. I >
  63. I >
  64. I >
  65. I >
  66. I >>-- 
  67. I >>Kevin J. Jarnot - Senior Software Engineer | mailto:jarnot@iddis.com 
  68. I >>IDD Information Services  Waltham, MA      |
  69. I >http://www-cs.canisius.edu/~jarnot
  70. I >
  71. I >
  72. I >
  73.  
  74. Verne H. Bohlender
  75. Box 416, Chesley, Ontario.Ca. N0G 1L0
  76. verneb@The-Fix.sos.on.ca
  77. ___
  78. * UniQWK #2158*
  79.  
  80.